package gui.gui2d.menu;
import java.awt.BorderLayout;
import java.awt.event.MouseListener;

import javax.swing.JPanel;
public class JPanelMenu extends JPanel {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	JPanelSelection selections;
	public JPanelMenu() {
		this.setOpaque(false);
		this.setLayout(new BorderLayout());
		selections= new JPanelSelection();
		selections.loadComponents();
		selections.start();
		this.add(selections,BorderLayout.CENTER);
	}
	
	public String getNickServerPlayer(){
		return selections.getNickServerPlayer();
	}
	
	public void removeSelection(){
		selections.removeText();
		selections.addNickEditPanel();
		revalidate();
	}
	
	public void waitingForClient(){
		selections.removeText();
		selections.addServerTexts();
	}

	public void addListenerConnection(MouseListener ml ){
		selections.addListenerConnectButton(ml);
	}
	public void addListenerBackButton(MouseListener ml ){
		selections.addListenerBackButton(ml);
	}
	public void addListenerBackButtonOnConnection(MouseListener ml ){
		selections.addListenerBackButtonOnConnection(ml);
	}

	public void setErrorNick(){
		selections.animateErrorNick();
	}
	public void loadMenuPanel(){
		selections.loadMenu();
		revalidate();
	}
	public void addListeners(MouseListener mouseListener) {
		selections.createServerListener(mouseListener);
		selections.searchNewGameOnLanListener(mouseListener);
		selections.createNewLocalGameListener(mouseListener);
		selections.exitListener(mouseListener);
		selections.createIAListener(mouseListener);
	}
	public String getPortServerPlayer() {
		return selections.getPortServerPlayer();
		
	}
}
